package com.osfw.framework.constants;


import java.util.Locale;

/**
 * 通用常量信息
 */
public class Constants {
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * 系统语言
     */
    public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE;

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 服务
     */
    public static final String APPLICATION_NAME = "DB Adminer";

    /**
     * basic账号/密码
     */
    public static final String BASIC_AUTH = String.join(":", "osfw", "osfw");

    /**
     * 服务
     */
    public static final String TEMP_TOKEN_NAME = "OSFW_TEMP_TOKEN";

    /**
     * 生成新的临时token，单位：秒
     */
    public static final int TEMP_TOKEN_TIMEOUT = 120;

    /**
     * 二次身份认证，单位：秒
     */
    public static final int OPEN_SAFE_TIMEOUT = 120;

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 系统用户授权缓存
     */
    public static final String SYS_AUTH_CACHE = "sys-authCache";

    /**
     * 参数管理 cache name
     */
    public static final String SYS_CONFIG_CACHE = "sys-config";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config:";

    /**
     * 字典管理 cache name
     */
    public static final String SYS_DICT_CACHE = "sys-dict";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict:";

    /**
     * 是否状态（Y是 1否）
     */
    public static final String YES = "1";
    public static final String NO = "0";

    /**
     * 是否状态（Y是 1否）
     */
    public static final Integer YES_INTEGER = 1;
    public static final Integer NO_INTEGER = 0;


    /**
     * 数据状态（0正常状态 1停用状态）
     */
    public static final String NORMAL = "0";
    public static final String DISABLE = "1";

    /**
     * 校验唯一标识（0唯一 1不唯一）
     */
    public final static String UNIQUE = "0";
    public final static String NOT_UNIQUE = "1";

    /**
     * 校验结果标识（0通过 1不通过）
     */
    public final static String CORRECT = "0";
    public final static String NOT_CORRECT = "1";


    /**
     * 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加）
     */
    public static final String[] JOB_WHITELIST_STR = {"com.osfw.quartz.task"};

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.osfw.common.utils.file", "com.osfw.common.config", "com.osfw.generator"};
}